<html>
<head>
	<meta charset="UTF-8">
	<meta content="IE=edge" http-equiv="X-UA-Compatible">
	<meta content="initial-scale=1.0, maximum-scale=1.0, user-scalable=no, width=device-width" name="viewport">
	<title>2094：[Poi2010]Ones</title>
	<!-- css -->
	<link href="../css/base.min.css" rel="stylesheet">
	<link href="../css/project.min.css" rel="stylesheet">
	
	<!-- favicon -->
	<!-- ... -->
</head>
<body class="page-brand">
	<header class="header header-transparent header-waterfall ui-header">
		<ul class="nav nav-list pull-left">
			<li>
				<a data-toggle="menu" href="#menu">
					<span class="icon icon-lg">menu</span>
				</a>
			</li>
		</ul>
		<a class="header-logo header-affix-hide margin-left-no margin-right-no" data-offset-top="213" data-spy="affix">[Poi2010]Ones</a>
		<span class="header-logo header-affix margin-left-no margin-right-no" data-offset-top="213" data-spy="affix">[Poi2010]Ones</span>
	</header>
	<nav aria-hidden="true" class="menu" id="menu" tabindex="-1">
		<div class="menu-scroll">
			<div class="menu-content">
				<a class="menu-logo" href="../index.html">BZOJ离线题库</a>
				<ul class="nav">
					<li>
						<a class="waves-attach" data-toggle="collapse" href="#problems">题目</a>
						<ul class="menu-collapse collapse in" id="problems">
							<li>
								<a class="waves-attach" href="../index.html">主页</a>
							</li>
							<li>
								<a class="waves-attach" href="../list.html">题目列表</a>
							</li>
						</ul>
					</li>
					<li>
						<a class="collapsed waves-attach" data-toggle="collapse" href="#about">关于</a>
						<ul class="menu-collapse collapse" id="about">
							<li>
								<a class="waves-attach" href="../about.html">关于此项目</a>
							</li>
						</ul>
					</li>
					
				</ul>
			</div>
		</div>
	</nav>
	<main class="content">
		<div class="content-header ui-content-header">
			<div class="container">
				<h1 class="content-heading">
                [Poi2010]Ones                </h1>
                <p>时间限制：10s&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  空间限制：259MB</p>			</div>
		</div>
		<div class="container">
			<section class="content-inner margin-top-no">
				<div class="row">
					<div class="col-lg-13 col-md-13">
						<div class="card margin-bottom-no">
							<div class="card-main">
								<div class="card-inner">
									
                                <h3>题目描述</h3><p><div><span style="font-size: medium">说有一个01串，去掉前导0和结尾0，那么现在有一头一尾两个1对不对&hellip;&hellip;</span></div>
<div><span style="font-size: medium">如果一个1，它处于<span style="line-height: 22px">开头</span><span style="line-height: 22px">或者</span><span style="line-height: 22px">结尾</span><span style="line-height: 22px">，且不与1相邻，那么就称之为ufo&hellip;&hellip;</span></span></div>
<div><span style="font-size: medium">10001010有两个ufo&hellip;&hellip;10000000000011000000有一个ufo&hellip;&hellip;10000001000000有两个ufo&hellip;&hellip;00000100000000000只有一个ufo</span></div>
<div><span style="font-size: medium"><span style="line-height: 22px">sks(n) = 1..n这n个数的二进制表示中ufo的总个数。</span></span></div>
<div><span style="font-size: medium">sks(5) = 5, sks(256) = 249</span></div>
<div><span style="font-size: medium">现在REP(n)表示把相同的叠在一起&hellip;&hellip;啥意思呢&hellip;&hellip;就是</span></div>
<div><span style="font-size: medium">REP(111111000001100) = {6, 5, 2, 2}</span></div>
<div><span style="font-size: medium">代表一开始有6个1，5个0，2个1，2个0。</span></div>
<div><span style="font-size: medium">现在给你REP(n)，要你求REP(sks(n))。</span></div>
<div><span style="font-size: medium">|REP(n)| &lt;= 10^6, n &lt;= 2 ^ (10 ^ 9)</span></div></p><hr/><h3>输入格式</h3><p><p><span style="font-size: medium">输入：第一行一个整数n（1&lt;=n&lt;=1000,000），第二行n个由空格隔开的整数xi（1&lt;=xi的总和&lt;=1000,000,000）用题目开头说过的方法描述了一个二进制数这个二进制数表示的整数，这个整数大于0，小于2的1000,000,000此方。 </span></p></p><hr/><h3>输出格式</h3><p><p><span style="font-size: medium">输出：第一行一个整数，为描述的二进制数的数字个数，第二行用题目开头的方法输出（用空格隔开），表示这个二进制数。</span></p></p><hr/><h3>样例输入</h3><pre>6
1 1 1 1 1 1  </pre><hr/><h3>样例输出</h3><pre>5
1 1 2 1 1  </pre><hr/><h3>提示</h3><p>没有写明提示</p><hr/><h3>题目来源</h3><p>没有写明来源</p>
								</div>
							</div>
						</div>
					</div>
				</div>
				
				
			</section>
		</div>
	</main>

	<div class="fbtn-container">
		<div class="fbtn-inner">
			<a class="fbtn fbtn-lg fbtn-brand-accent waves-attach waves-circle waves-light waves-effect" data-toggle="dropdown" aria-expanded="true"><span class="fbtn-text fbtn-text-left">Menu</span><span class="fbtn-ori icon">apps</span><span class="fbtn-sub icon">close</span></a>
			<div class="fbtn-dropup">
				<a class="fbtn fbtn-brand waves-attach waves-circle waves-light waves-effect" href="../list.html" target="_self"><span class="fbtn-text fbtn-text-left">题目列表</span><span class="icon">menu</span></a>
				<a class="fbtn fbtn-green waves-attach waves-circle waves-effect" href="../index.html" target="_self"><span class="fbtn-text fbtn-text-left">返回主页</span><span class="icon">home</span></a>
				<a class="fbtn waves-attach waves-circle waves-effect" href="http://www.lydsy.com/JudgeOnline/submitpage.php?id=2094" target="_blank"><span class="fbtn-text fbtn-text-left">提交代码</span><span class="icon">send</span></a>
				<a class="fbtn fbtn-orange waves-attach waves-circle waves-effect" href="http://www.lydsy.com/JudgeOnline/wttl/wttl.php?pid=2094" target="_blank"><span class="fbtn-text fbtn-text-left">试题讨论</span><span class="icon">chat</span></a>
				
			</div>
		</div>
	</div>

	<!-- js -->
	<script src="../js/jquery.min.js"></script>
	<script src="../js/base.min.js"></script>
	<script src="../js/project.min.js"></script>
</body>
</html>